package com.Xht.www.servlet;

//后端响应查询充值信息是否为申请中的请求

import com.Xht.www.po.UserWalletBalancePO;
import com.Xht.www.service.UserAdmin;
import com.Xht.www.serviceImpl.UserAdminImpl;
import com.google.gson.Gson;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet("/GetPendingRechargesServlet")
public class GetPendingRechargesServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        UserAdmin userAdmin = new UserAdminImpl();
        List<UserWalletBalancePO> pendingRecharges = userAdmin.getPendingRecharges();

        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        Gson gson = new Gson();
        out.print(gson.toJson(pendingRecharges));
        out.flush();
    }
}
